﻿app.factory('AlertService', [function () {
    var alertArray = [];

    var addAlert = function (message) {
        var a = {
            type: 'success',
            msg: message
        }
        alertArray.push(a);
    }

    var getAlerts = function () {
        return alertArray;
    }

    var removeAlert = function (index) {
        alertArray.splice(index, 1);
    }

    return {
        addAlert: addAlert,
        getAlerts: getAlerts,
        removeAlert: removeAlert
    };
}]);